﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Text;
using System.Windows.Forms;
using S5230WallpaperCreator.Properties;
using System.Diagnostics;
using System.IO;

namespace S5230WallpaperCreator
{
    /// <summary>
    /// 
    /// </summary>
    public partial class WallpaperViewUserControl : UserControl
    {
        private Size _imageSize = new Size(240, 400);

        private PictureBox InnerDragAndDropPictureBox { get; set; }

        /// <summary>
        /// Gets or sets the size of the image.
        /// </summary>
        /// <value>The size of the image.</value>
        public Size ImageSize
        {
            get
            {
                return _imageSize;
            }
            set
            {
                _imageSize = value;

                RecalculateMinimumSize();
                RecalculatePictureBoxPositions();
            }
        }

        /// <summary>
        /// Gets the left image.
        /// </summary>
        /// <value>The left image.</value>
        public Image LeftImage 
        { 
            get { return pictureBoxLeft.Image; } 
            set { pictureBoxLeft.Image = value; } 
        }

        /// <summary>
        /// Gets the center image.
        /// </summary>
        /// <value>The center image.</value>
        public Image CenterImage 
        { 
            get { return pictureBoxCenter.Image; }
            set { pictureBoxCenter.Image = value; } 
        }

        /// <summary>
        /// Gets the right image.
        /// </summary>
        /// <value>The right image.</value>
        public Image RightImage 
        { 
            get { return pictureBoxRight.Image; }
            set { pictureBoxRight.Image = value; } 
        }

        /// <summary>
        /// Gets the initial image.
        /// </summary>
        /// <value>The initial image.</value>
        public Image InitialImage { get { return this.pictureBoxLeft.InitialImage; } }

        /// <summary>
        /// Recalculates the minimum size.
        /// </summary>
        private void RecalculateMinimumSize()
        {
            this.MinimumSize = new Size(this.ImageSize.Width * 3, this.ImageSize.Height);
        }

        /// <summary>
        /// Initializes a new instance of the <see cref="this"/> class.
        /// </summary>
        public WallpaperViewUserControl()
        {
            InitializeComponent();

            pictureBoxLeft.AllowDrop = true;
            pictureBoxRight.AllowDrop = true;
            pictureBoxCenter.AllowDrop = true;
        }

        /// <summary>
        /// Recalculates the picture box positions.
        /// </summary>
        private void RecalculatePictureBoxPositions()
        {
            int offsetX = (this.Size.Width - this.ImageSize.Width*3) / 2;
            int offsetY = (this.Size.Height - this.ImageSize.Height) / 2;

            // Set picture Boxes Size
            this.pictureBoxLeft.Size = this.ImageSize;
            this.pictureBoxCenter.Size = this.ImageSize;
            this.pictureBoxRight.Size = this.ImageSize;

            // Set picture Boxes Location
            this.pictureBoxLeft.Location = new Point(offsetX + this.ImageSize.Width * 0, offsetY);
            this.pictureBoxCenter.Location = new Point(offsetX + this.ImageSize.Width * 1-1, offsetY);
            this.pictureBoxRight.Location = new Point(offsetX + this.ImageSize.Width * 2-2, offsetY);

            // Set Image Action Toolbar 
            int btnOffsetX = (this.ImageSize.Width - this.splitButtonLeft.Width) / 2;
            int btnOffsetY = -6 - this.splitButtonLeft.Height;

            this.splitButtonLeft.Location = new Point(this.pictureBoxLeft.Location.X + btnOffsetX, this.pictureBoxLeft.Location.Y + btnOffsetY);this.splitButtonLeft.Location = new Point(this.pictureBoxLeft.Location.X + btnOffsetX, this.pictureBoxLeft.Location.Y + btnOffsetY);
            this.splitButtonCenter.Location = new Point(this.pictureBoxCenter.Location.X + btnOffsetX, this.pictureBoxCenter.Location.Y + btnOffsetY);
            this.splitButtonRight.Location = new Point(this.pictureBoxRight.Location.X + btnOffsetX, this.pictureBoxRight.Location.Y + btnOffsetY);
        }

        /// <summary>
        /// Handles the SizeChanged event of the this control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
        private void WallpaperViewUserControl_SizeChanged(object sender, EventArgs e)
        {
            RecalculatePictureBoxPositions();
        }

        /// <summary>
        /// Handles the DragDrop event of the pictureBoxLeft control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="System.Windows.Forms.DragEventArgs"/> instance containing the event data.</param>
        private void pictureBoxLeft_DragDrop(object sender, DragEventArgs e)
        {
            if (e.Data.GetDataPresent(DataFormats.FileDrop))
            {
                string[] files = (string[])e.Data.GetData(DataFormats.FileDrop);

                try
                {
                    if (files.Length > 0)
                    {
                        pictureBoxLeft.Image = Image.FromFile(files[0]);
                    }
                }
                catch (Exception ex)
                {
                    MessageBox.Show(this,
                        string.Format(Resources.Error_CanNotOpenImage, files[0], ex.Message),
                        Resources.Error_OpenImage_Caption,
                        MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
            else if (e.Data.GetDataPresent(DataFormats.Bitmap))
            {
                if (this.InnerDragAndDropPictureBox == null || (e.KeyState & 0x08) != 0)
                {
                    pictureBoxLeft.Image = (Image)e.Data.GetData(DataFormats.Bitmap);
                }
                else
                {
                    Image tmpImage = pictureBoxLeft.Image;
                    pictureBoxLeft.Image = this.InnerDragAndDropPictureBox.Image;
                    this.InnerDragAndDropPictureBox.Image = tmpImage;
                }
            }
        }

        /// <summary>
        /// Handles the DragDrop event of the pictureBoxCenter control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="System.Windows.Forms.DragEventArgs"/> instance containing the event data.</param>
        private void pictureBoxCenter_DragDrop(object sender, DragEventArgs e)
        {
            if (e.Data.GetDataPresent(DataFormats.FileDrop))
            {
                string[] files = (string[])e.Data.GetData(DataFormats.FileDrop);

                try
                {
                    if (files.Length > 0)
                    {
                        pictureBoxCenter.Image = Image.FromFile(files[0]);
                    }
                }
                catch (Exception ex)
                {
                    MessageBox.Show(this,
                        string.Format(Resources.Error_CanNotOpenImage, files[0], ex.Message),
                        Resources.Error_OpenImage_Caption,
                        MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
            else if (e.Data.GetDataPresent(DataFormats.Bitmap))
            {
                if (this.InnerDragAndDropPictureBox == null || (e.KeyState & 0x08) != 0)
                {
                    pictureBoxCenter.Image = (Image)e.Data.GetData(DataFormats.Bitmap);
                }
                else
                {
                    Image tmpImage = pictureBoxCenter.Image;
                    pictureBoxCenter.Image = this.InnerDragAndDropPictureBox.Image;
                    this.InnerDragAndDropPictureBox.Image = tmpImage;
                }
            }
        }

        /// <summary>
        /// Handles the DragDrop event of the pictureBoxRight control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="System.Windows.Forms.DragEventArgs"/> instance containing the event data.</param>
        private void pictureBoxRight_DragDrop(object sender, DragEventArgs e)
        {
            if (e.Data.GetDataPresent(DataFormats.FileDrop))
            {
                string[] files = (string[])e.Data.GetData(DataFormats.FileDrop);

                try
                {
                    if (files.Length > 0)
                    {
                        pictureBoxRight.Image = Image.FromFile(files[0]);
                    }
                }
                catch (Exception ex)
                {
                    MessageBox.Show(this,
                        string.Format(Resources.Error_CanNotOpenImage, files[0], ex.Message),
                        Resources.Error_OpenImage_Caption,
                        MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
            else if (e.Data.GetDataPresent(DataFormats.Bitmap))
            {
                if (this.InnerDragAndDropPictureBox == null || (e.KeyState & 0x08) != 0)
                {
                    pictureBoxRight.Image = (Image)e.Data.GetData(DataFormats.Bitmap);
                }
                else
                {
                    Image tmpImage = pictureBoxRight.Image;
                    pictureBoxRight.Image = this.InnerDragAndDropPictureBox.Image;
                    this.InnerDragAndDropPictureBox.Image = tmpImage;
                }
            }
        }



        /// <summary>
        /// Handles the DragEnter event of the pictureBoxLeft control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="System.Windows.Forms.DragEventArgs"/> instance containing the event data.</param>
        private void pictureBoxLeft_DragEnter(object sender, DragEventArgs e)
        {
            if (e.Data.GetDataPresent(DataFormats.FileDrop))
                e.Effect = (DragDropEffects.Copy & e.AllowedEffect);
            else if (e.Data.GetDataPresent(DataFormats.Bitmap))
            {
                if (this.InnerDragAndDropPictureBox == null || (e.KeyState & 0x08) != 0)
                    e.Effect = (DragDropEffects.Copy & e.AllowedEffect);
                else
                    e.Effect = (DragDropEffects.Move & e.AllowedEffect);
            }
            else
                e.Effect = DragDropEffects.None;
        }

        /// <summary>
        /// Handles the DragEnter event of the pictureBoxCenter control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="System.Windows.Forms.DragEventArgs"/> instance containing the event data.</param>
        private void pictureBoxCenter_DragEnter(object sender, DragEventArgs e)
        {
            pictureBoxLeft_DragEnter(sender, e);
        }

        /// <summary>
        /// Handles the DragEnter event of the pictureBoxRight control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="System.Windows.Forms.DragEventArgs"/> instance containing the event data.</param>
        private void pictureBoxRight_DragEnter(object sender, DragEventArgs e)
        {
            pictureBoxLeft_DragEnter(sender, e);
        }

        /// <summary>
        /// Handles the MouseDown event of the pictureBoxLeft control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="System.Windows.Forms.MouseEventArgs"/> instance containing the event data.</param>
        private void pictureBoxLeft_MouseDown(object sender, MouseEventArgs e)
        {
            InnerDragAndDropPictureBox = pictureBoxLeft;

            try
            {
                pictureBoxLeft.DoDragDrop(pictureBoxLeft.Image, DragDropEffects.Copy | DragDropEffects.Move);
            }
            finally
            {
                this.InnerDragAndDropPictureBox = null;
            }
        }

        /// <summary>
        /// Handles the MouseDown event of the pictureBoxCenter control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="System.Windows.Forms.MouseEventArgs"/> instance containing the event data.</param>
        private void pictureBoxCenter_MouseDown(object sender, MouseEventArgs e)
        {
            InnerDragAndDropPictureBox = pictureBoxCenter;

            try
            {
                pictureBoxCenter.DoDragDrop(pictureBoxCenter.Image, DragDropEffects.Copy | DragDropEffects.Move);
            }
            finally
            {
                this.InnerDragAndDropPictureBox = null;
            }
        }

        /// <summary>
        /// Handles the MouseDown event of the pictureBoxRight control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="System.Windows.Forms.MouseEventArgs"/> instance containing the event data.</param>
        private void pictureBoxRight_MouseDown(object sender, MouseEventArgs e)
        {
            InnerDragAndDropPictureBox = pictureBoxRight;

            try
            {
                pictureBoxRight.DoDragDrop(pictureBoxRight.Image, DragDropEffects.Copy | DragDropEffects.Move);
            }
            finally
            {
                this.InnerDragAndDropPictureBox = null;
            }
        }

        /// <summary>
        /// Handles the DragOver event of the pictureBoxLeft control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="System.Windows.Forms.DragEventArgs"/> instance containing the event data.</param>
        private void pictureBoxLeft_DragOver(object sender, DragEventArgs e)
        {
            pictureBoxLeft_DragEnter(sender, e);
        }

        /// <summary>
        /// Handles the DragOver event of the pictureBoxCenter control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="System.Windows.Forms.DragEventArgs"/> instance containing the event data.</param>
        private void pictureBoxCenter_DragOver(object sender, DragEventArgs e)
        {
            pictureBoxLeft_DragEnter(sender, e);
        }

        /// <summary>
        /// Handles the DragOver event of the pictureBoxRight control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="System.Windows.Forms.DragEventArgs"/> instance containing the event data.</param>
        private void pictureBoxRight_DragOver(object sender, DragEventArgs e)
        {
            pictureBoxLeft_DragEnter(sender, e);
        }

        /// <summary>
        /// Resets all images.
        /// </summary>
        public void ResetAllImages()
        {
            ResetLeftImage();
            ResetCenterImage();
            ResetRightImage();
        }

        /// <summary>
        /// Resets the right image.
        /// </summary>
        public void ResetRightImage()
        {
            pictureBoxRight.Image = pictureBoxRight.InitialImage;
        }

        /// <summary>
        /// Resets the center image.
        /// </summary>
        public void ResetCenterImage()
        {
            pictureBoxCenter.Image = pictureBoxCenter.InitialImage;
        }

        /// <summary>
        /// Resets the left image.
        /// </summary>
        public void ResetLeftImage()
        {
            pictureBoxLeft.Image = pictureBoxLeft.InitialImage;
        }

        /// <summary>
        /// Selects the left image.
        /// </summary>
        public void SelectLeftImage()
        {
            if (Directory.Exists(Settings.Default.MainDialog_SourceImageFolder))
                openLeftFileDialog.InitialDirectory = Settings.Default.MainDialog_SourceImageFolder;

            if (openLeftFileDialog.ShowDialog() == DialogResult.OK)
            {
                try
                {
                    this.LeftImage = Image.FromFile(openLeftFileDialog.FileName);
                }
                catch (Exception ex)
                {
                    MessageBox.Show(this,
                        string.Format(Resources.Error_CanNotOpenImage, openLeftFileDialog.FileName, ex.Message),
                        Resources.Error_OpenImage_Caption,
                        MessageBoxButtons.OK, MessageBoxIcon.Error);
                }

                Settings.Default.MainDialog_SourceImageFolder = Path.GetDirectoryName(openLeftFileDialog.FileName);
                Settings.Default.Save();
            }
        }

        /// <summary>
        /// Selects the center image.
        /// </summary>
        public void SelectCenterImage()
        {
            if (Directory.Exists(Settings.Default.MainDialog_SourceImageFolder))
                openCenterFileDialog.InitialDirectory = Settings.Default.MainDialog_SourceImageFolder;

            if (openCenterFileDialog.ShowDialog() == DialogResult.OK)
            {
                try
                {
                    this.CenterImage = Image.FromFile(openCenterFileDialog.FileName);
                }
                catch (Exception ex)
                {
                    MessageBox.Show(this,
                        string.Format(Resources.Error_CanNotOpenImage, openCenterFileDialog.FileName, ex.Message),
                        Resources.Error_OpenImage_Caption,
                        MessageBoxButtons.OK, MessageBoxIcon.Error);
                }

                Settings.Default.MainDialog_SourceImageFolder = Path.GetDirectoryName(openCenterFileDialog.FileName);
                Settings.Default.Save();

            }
        }

        /// <summary>
        /// Selects the right image.
        /// </summary>
        public void SelectRightImage()
        {
            if (Directory.Exists(Settings.Default.MainDialog_SourceImageFolder))
                openRightFileDialog.InitialDirectory = Settings.Default.MainDialog_SourceImageFolder;

            if (openRightFileDialog.ShowDialog() == DialogResult.OK)
            {
                try
                {
                    this.RightImage = Image.FromFile(openRightFileDialog.FileName);
                }
                catch (Exception ex)
                {
                    MessageBox.Show(this,
                        string.Format(Resources.Error_CanNotOpenImage, openRightFileDialog.FileName, ex.Message),
                        Resources.Error_OpenImage_Caption,
                        MessageBoxButtons.OK, MessageBoxIcon.Error);
                }

                Settings.Default.MainDialog_SourceImageFolder = Path.GetDirectoryName(openRightFileDialog.FileName);
                Settings.Default.Save();
            }
        }



        /// <summary>
        /// Handles the ButtonClick event of the splitButtonLeft control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
        private void splitButtonLeft_ButtonClick(object sender, EventArgs e)
        {
            SelectLeftImage();
        }

        /// <summary>
        /// Handles the ButtonClick event of the splitButtonCenter control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
        private void splitButtonCenter_ButtonClick(object sender, EventArgs e)
        {
            SelectCenterImage();
        }

        /// <summary>
        /// Handles the ButtonClick event of the splitButtonRight control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
        private void splitButtonRight_ButtonClick(object sender, EventArgs e)
        {
            SelectRightImage();
        }

        /// <summary>
        /// Handles the Click event of the tsLeftCopy control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
        private void tsLeftCopy_Click(object sender, EventArgs e)
        {
            Clipboard.SetData(DataFormats.Bitmap, this.LeftImage);
        }

        /// <summary>
        /// Handles the Click event of the tsLeftPaste control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
        private void tsLeftPaste_Click(object sender, EventArgs e)
        {
            if (Clipboard.ContainsData(DataFormats.FileDrop))
            {
                string[] files = (string[])Clipboard.GetData(DataFormats.FileDrop);

                try
                {
                    if (files.Length > 0)
                    {
                        this.LeftImage = Image.FromFile(files[0]);
                    }
                }
                catch (Exception ex)
                {
                    MessageBox.Show(this,
                        string.Format(Resources.Error_CanNotOpenImage, files[0], ex.Message),
                        Resources.Error_OpenImage_Caption,
                        MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
            else if (Clipboard.ContainsData(DataFormats.Bitmap))
            {
                this.LeftImage = (Image)Clipboard.GetData(DataFormats.Bitmap);
            }
        }

        /// <summary>
        /// Handles the Click event of the tsLeftSwap control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
        private void tsLeftSwap_Click(object sender, EventArgs e)
        {
            SwitchLeftCenterImages();
        }

        /// <summary>
        /// Handles the Click event of the tsLeftClear control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
        private void tsLeftClear_Click(object sender, EventArgs e)
        {
            this.ResetLeftImage();
        }

        /// <summary>
        /// Handles the Click event of the tsCenterCopy control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
        private void tsCenterCopy_Click(object sender, EventArgs e)
        {
            Clipboard.SetData(DataFormats.Bitmap, this.CenterImage);
        }

        /// <summary>
        /// Handles the Click event of the tsCenterPaste control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
        private void tsCenterPaste_Click(object sender, EventArgs e)
        {
            if (Clipboard.ContainsData(DataFormats.FileDrop))
            {
                string[] files = (string[])Clipboard.GetData(DataFormats.FileDrop);

                try
                {
                    if (files.Length > 0)
                    {
                        this.CenterImage = Image.FromFile(files[0]);
                    }
                }
                catch (Exception ex)
                {
                    MessageBox.Show(this,
                        string.Format(Resources.Error_CanNotOpenImage, files[0], ex.Message),
                        Resources.Error_OpenImage_Caption,
                        MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
            else if (Clipboard.ContainsData(DataFormats.Bitmap))
            {
                this.CenterImage = (Image)Clipboard.GetData(DataFormats.Bitmap);
            }
        }

        /// <summary>
        /// Handles the Click event of the tsCenterClear control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
        private void tsCenterClear_Click(object sender, EventArgs e)
        {
            this.ResetCenterImage();
        }

        /// <summary>
        /// Handles the Click event of the tsRightCopy control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
        private void tsRightCopy_Click(object sender, EventArgs e)
        {
            Clipboard.SetData(DataFormats.Bitmap, this.RightImage);
        }

        /// <summary>
        /// Handles the Click event of the tsRightPaste control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
        private void tsRightPaste_Click(object sender, EventArgs e)
        {
            if (Clipboard.ContainsData(DataFormats.FileDrop))
            {
                string[] files = (string[])Clipboard.GetData(DataFormats.FileDrop);

                try
                {
                    if (files.Length > 0)
                    {
                        this.RightImage = Image.FromFile(files[0]);
                    }
                }
                catch (Exception ex)
                {
                    MessageBox.Show(this,
                        string.Format(Resources.Error_CanNotOpenImage, files[0], ex.Message),
                        Resources.Error_OpenImage_Caption,
                        MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
            else if (Clipboard.ContainsData(DataFormats.Bitmap))
            {
                this.RightImage = (Image)Clipboard.GetData(DataFormats.Bitmap);
            }
        }

        /// <summary>
        /// Handles the Click event of the tsRightSwap control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
        private void tsRightSwap_Click(object sender, EventArgs e)
        {
            SwitchCenterRightImages();
        }

        /// <summary>
        /// Handles the Click event of the tsRightClear control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
        private void tsRightClear_Click(object sender, EventArgs e)
        {
            this.ResetRightImage();
        }

        /// <summary>
        /// Switches the center right images.
        /// </summary>
        public void SwitchCenterRightImages()
        {
            Image tmpImage = this.CenterImage;
            this.CenterImage = this.RightImage;
            this.RightImage = tmpImage;
        }

        public void SwitchLeftRightImages()
        {
            Image tmpImage = this.LeftImage;
            this.LeftImage = this.RightImage;
            this.RightImage = tmpImage;
        }

        /// <summary>
        /// Switches the left center images.
        /// </summary>
        public void SwitchLeftCenterImages()
        {
            Image tmpImage = this.CenterImage;
            this.CenterImage = this.LeftImage;
            this.LeftImage = tmpImage;
        }

        /// <summary>
        /// Handles the Click event of the tsLeftCenterSwap control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
        private void tsLeftCenterSwap_Click(object sender, EventArgs e)
        {
            this.SwitchLeftCenterImages();
        }

        /// <summary>
        /// Handles the Click event of the tsCenterRightSwap control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
        private void tsCenterRightSwap_Click(object sender, EventArgs e)
        {
            this.SwitchCenterRightImages();
        }

    }
}
